/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
    
package be.vdabantwerpen.gow.dao;
    
import be.vdabantwerpen.gow.entities.GOWUser;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Tim.VandenLangenberg
 * @version 12/06/2013
 */
public class UserDAOTemp implements UserDAO {
    private final List<GOWUser> users = new ArrayList();
    
    {
        //TODO: Vul users
    }
    
    @Override
    public void create(GOWUser user){
        users.add(user);
    }
    
    @Override
    public GOWUser read(int userId){
        for(int i = 0; i < users.size(); i++){
            GOWUser user = users.get(i);
            if(user.getUserId() == userId){
                return user;
            }
        }
        return null;
    }
    
    @Override
    public void update(GOWUser user){
        int index = users.indexOf(user);
        users.remove(index);
        users.add(index, user);
    }
    
    @Override
    public void delete(GOWUser user){
        users.remove(user);
    }
    
    @Override
    public List<GOWUser> findAll(){
        return users;
    }
    
}